#include "webctl.h"




const String ROOT_HTML_BODY = "<h4>POST 提交设置端口</h4><br>\
    <form method=\"post\" enctype=\"application/x-www-form-urlencoded\" action=\"/setgpio\" target=\"blankFrame\">\
      <input type=\"text\" name=\"pin\" value=\"2\" placeholder=\"GPIO端口:2-LED\"><br>\
      <input type=\"text\" name=\"model\" value=\"out\" placeholder=\"模式:in/out\"><br>\
      <input type=\"text\" name=\"val\" value=\"1\" placeholder=\"信号:0/1\"><br>\
      <input type=\"Submit\" value=\"提交\">\
    </form>\
    <h4>POST 查询端口状态</h4><br>\
    <form method=\"post\" enctype=\"application/x-www-form-urlencoded\" action=\"/getgpio\" target=\"blankFrame\">\
      <input type=\"text\" name=\"pin\" value=\"2\" placeholder=\"GPIO端口:2-LED\"><br>\
      <input type=\"Submit\" value=\"查询\">\
    </form>\
    <iframe src=\"about:blank\" name=\"blankFrame\" id=\"blankFrame\" style=\"display: visable;width:100%;\"></iframe>";

String HTMLUtil::htmlTemplate(String body) {
  return "<html>\
  <head>\
    <title>ESP8266 Web Control</title>\
    <style>\
      body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
      intput{width:100%;}\
    </style>\
    <meta charset=\"utf-8\">\
    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes\" />\
  </head>\
  <body>"
         + body +
         "</body>\
  </html>";
}

String HTMLUtil::rootBody(void) {
  return ROOT_HTML_BODY;
}
